<?php
/**
 * @Name: UserSaveRequest.php
 * @Author: yashuai<1762910894@qq.com>
 * @Desc: 添加编辑用户
 */

namespace app\common\requests\rbac;

use app\common\requests\PackingRequest;

class UserSaveRequest extends PackingRequest
{

    public function rules()
    {
        return [
            'UserName'   => 'require|max:50',
            'NickName'   => 'require|max:20',
            'UserEmail'  => 'email',
            'IsSuper'    => 'in:0,1',
            'UserStatus' => 'in:1,2',
            'RoleID'     => 'array',
        ];
    }

    public function message()
    {
        return [
            'UserID.require'         => '缺少记录ID参数',
            'UserID.integer'          => '记录ID参数类型异常',
            'UserName.require'       => '请输入账号',
            'UserName.max'            => '账号长度过长',
            'UserPassword.require'   => '请输入用户密码',
            'UserPassword.length'    => '密码长度为6-30位',
            'UserPassword.alphaDash' => '密码只能包含字母、数字，以及破折号和下划线',
            'NickName.require'       => '请输入昵称',
            'NickName.max'            => '昵称长度过长',
            'UserEmail.email'         => '邮箱格式错误',
            'IsSuper.in'              => '是否为超级管理员参数不在范围',
            'UserStatus.in'           => '用户状态参数不在范围',
            'RoleID.array'            => '角色ID参数格式异常',
        ];
    }

}
